/*
 * ============================================================================
 * Copyright Notice!
 * ----------------------------------------------------------------------------
 * This file contains proprietary and confidential information belonging to the
 * group of people involvled in developing this project.  Reproduction, disclosure 
 * or use without specific written authorization from project stake holders is 
 * prohibited. Please refer the readme.txt in project installation folder for more
 * specific contacts
 *
 * All rights reserved.
 * ============================================================================
 */
package edu.uwm.universitydb.dao.user;

import java.sql.PreparedStatement;
import java.sql.SQLException;

import edu.uwm.universitydb.framework.transactional.db.command.impl.TransactionalDataManipulationCommandBase;

/**
 * Command to delete a record from user table <code>DeleteUserCommand</type> here
 * 
 * @author Shyam Nair
 */
public class DeleteUserCommand extends TransactionalDataManipulationCommandBase
{
    /** query for delete */
    private static final String SQL_QUERY = "DELETE FROM USERS WHERE USERNAME = ?";

    /** attribute for holding user name */
    private final String mUserName;

    /**
     * 
     * @param userName
     */
    public DeleteUserCommand(final String userName)
    {
        mUserName = userName;
    }

    /*
     * (non-javadoc)
     * @see edu.uwm.cs757.framework.db.command.DBCommand#getSQL()
     */
    @Override
    public String getSQL()
    {
        return SQL_QUERY;
    }

    /*
     * (non-javadoc)
     * @see edu.uwm.cs757.framework.db.command.DBCommand#setParameters(java.sql.PreparedStatement)
     */
    @Override
    public void setParameters(final PreparedStatement pStmt) throws SQLException
    {
        pStmt.setString(1, mUserName);
    }

}
/*
 * ============================================================================
 * Change History
 * ----------------------------------------------------------------------------
 * Apr 9, 2014   Shyam Nair
 * File created
 * ----------------------------------------------------------------------------
 */